package com.yj.common.core.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yj.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Setter
@Getter
@Document(indexName = "fileinfo",createIndex = false)
public class FileInfo {
    /**
    * 主键
    */
    @Id
    @Field(name = "id", type = FieldType.Integer)
    private Integer id;

    /**
    * 文件名称
    */
    @Field(name = "fileName", type = FieldType.Text,analyzer = "jieba_index",searchAnalyzer = "jieba_index")
    private String fileName;

    /**
    * 文件类型
    */
    @Field(name = "fileType",  type = FieldType.Text)
    private String fileType;

    /**
     * 文件类型id
     */
    @Field(name = "fileTypeId",  type = FieldType.Text)
    private Integer fileTypeId;

    /**
     * 标签名称
     */
    @Field(name = "tagName",  type = FieldType.Text)
    private String tagName;

    /**
     * 标签id
     */
    @Field(name = "tagId",  type = FieldType.Text)
    private String tagId;
    /**
    * 内容类型
    */
    @Field(name = "contentType", type = FieldType.Text)
    private String contentType;

    /**
     * 附件内容
     */
    @Field(name = "attachment.content", type = FieldType.Text,analyzer = "jieba_index",searchAnalyzer = "jieba_index")
    @TableField(exist = false)
    private String content;

    /**
     * 备注
     */
    private String remark;

    /**
     * 是否公开
     */
    @Field(name = "isOpen", type = FieldType.Keyword)
    private Integer isOpen;

    /**
    * 文件地址
    */
    @Field(name = "fileUrl", type = FieldType.Text)
    private String fileUrl;

    /**
     * 部门id
     */
    @Field(name = "isOpen", type = FieldType.Keyword)
    private Integer deptId;

    /**
     * 部门名称
     */
    @TableField(exist = false)
    private String deptName;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 数据状态 0.可用 1.删除
     */
    private Integer status;

    /**
     * 创建人
     */
    private String createBy;

    /**
     * 创建人
     */
    @TableField(exist = false)
    private String createName;

    /**
     * 是否可编辑
     */
    @TableField(exist = false)
    private Integer isEdit;

    /**
     * 更新人
     */
    private String updateBy;

}